package com.gxsf.back.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.util.Collections;

/**
 * @author BeijiRonin
 * @date 2020/11/12
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo());
    }
    private ApiInfo apiInfo() {
        return new ApiInfo(
                "广西师范大学漓江学院图书预定系统 - 微信端 - 后台接口",
                "仅用于 易行约座 微信端接口使用，禁止非法调用接口。 " +
                        "BeijiRonin Development Team",
                "API V1.0.0",
                "https://gitee.com/giaog",
                new Contact("维护请找", "https://gitee.com/giaog", "051011@163.com"),
                "BeijiRonin", "https://gitee.com/giaog", Collections.emptyList());
    }
}